package cn.lg.soar.system.auth.model;

import cn.lg.soar.common.util.BeanCopier;
import cn.lg.soar.system.auth.entity.AccountBind;
import cn.lg.soar.system.auth.entity.Role;
import cn.lg.soar.system.auth.entity.User;
import io.swagger.annotations.ApiModelProperty;
import lombok.Getter;
import lombok.Setter;

import java.util.List;

/**
 * @author luguoxiang
 * 开源项目：https://gitee.com/lgx1992/lg-soar 求star！请给我star！请帮我点个star！
 */
@Getter
@Setter
public class UserDetailVo extends User {

    private static final long serialVersionUID = 6850908496978491051L;

    public final static BeanCopier<User, UserDetailVo> FROM_ENTITY = BeanCopier.create(User.class, UserDetailVo.class);
    public final static BeanCopier<UserDetailVo, User> TO_ENTITY = BeanCopier.create(UserDetailVo.class, User.class);

    @ApiModelProperty(value = "机构")
    private List<UserOrgItemVO> orgs;

    @ApiModelProperty(value = "角色")
    private List<Role> roles;

    @ApiModelProperty(value = "账号")
    private List<AccountBind> accountBinds;

    public UserDetailVo() {
    }

    public UserDetailVo(User data) {
        FROM_ENTITY.copy(data, this);
    }

    public User toUser(){
        return TO_ENTITY.convert(this);
    }
}
